package com.ztgf.order.models.service;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.ztgf.common.constant.Result;
import com.ztgf.order.models.bo.*;
import com.ztgf.order.models.dto.OrderContractParamRelationDTO;
import com.ztgf.order.models.dto.OrderInfoDTO;
import com.ztgf.order.models.dto.purchase.PurchaseCommodityBargainDTO;
import com.ztgf.order.models.vo.*;
import com.ztgf.pay.models.bo.PayBatchPrintBO;
import com.ztgf.pay.models.dto.PayOrderMotherDTO;
import com.ztgf.pay.models.vo.PayBatchPrintVO;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 订单表服务
 *
 * @author chenyu.wang
 * @Date 2020-06-03 15:32:26
 */
public interface IOrderInfoService extends IService<OrderInfoDTO> {

    List<Long> getListBuyerIdBySellerShopId(Long sellerShopId);

    void sendWebMessageInChangeOrderStatus(Long shopId, int type, Long orderId);

    void sendMessage(List<Long> shopIdList);

    boolean add(OrderInfoSaveBO orderInfoSaveBO);


    /**
     * description: 获取店铺的售后率
     * param: shopId
     * author: zhanghualang
     * date: 2020-06-11
     * return: String
     */
    String getShopOrderAfterSale(Long shopId);

    /**
     * description: 获取买家店铺消费总金额
     * param: shopId
     * author: zhanghualang
     * date: 2020-06-12
     * return: BigDecimal
     */
    BigDecimal getBuyShopConsumption(Long buyShopId, Long sellShopId);

    Result<ShopCartDataVO> getShopCardData(ShopCartDataBO shopCartDataBO);

    Result<ShopCartDataVO> getShopCardDataForPurchaseInfo(Long purchaseCommodityBargainId,Long buyerShopId);

    Result<List<Long>> createOrder(OrderDataBO orderDataBO, String sessionId);

    List<OrderContractVO> sureOrder(String orderIds, Long signShopId, int type, List<byte[]> bytes);

    List<OrderInfoVO> getOrderInfoByOrderId(String ids);

    Result<String> updateContactByOrderId(OrderContractParamRelationDTO orderContractParamRelationDTO, String param, byte[] bytes) throws IOException;

    boolean urgeSignContact(Long orderId, Long sellShopId);

    boolean productOver(Long orderId);

    void urgeShipments(Long orderId, Long sellShopId);

    boolean deleteOrder(Long orderId, int type);

    /**
     * description: 查询订单详情
     * param: [id]
     * author: chenyu.wang
     * date: 2020-06-29
     * return: com.ztgf.order.models.vo.OrderDetailsVO
     */
    OrderDetailsVO getOrderDetailsById(Long id);

    Result<?> cancelOrder(Long orderId, int type, String cancelReasonType);

    boolean updateRightsProtection(Long orderId, int type,String reason);

    Result signOver(Long orderId, int type);

    //Page<OrderInfoVO> getListOrderByOrderState(int pageNo, int pageSize, int type);

    /**
     * description: 订单列表
     * param: [bo]
     * author: chenyu.wang
     * date: 2020-07-01
     * return: java.util.List<com.ztgf.order.models.vo.OrderInfoPageListVO>
     */
    Page<OrderInfoPageListVO> queryListPage(OrderInfoGoodsPageBO bo);

    Result<PayOrderMotherDTO> orderPay(OrderPayInfoBO orderPayInfoBO);

//    boolean updatePaySuccess(Long orderId);

    List<OrderInfoSalesVO> querySalesList(Long shopId, String startDate, String endDate);//获取店铺的销售额

    OrderPayPageVO getSkipPay(String orderIds);

    Map<String, Object> getPayInfoByOrderIds(String orderIds);

    List<OrderContractVO> getOrderContarctInfo(Long shopId, String orderIds, int type, int signType);

    /**
     * description: 后台管理系统订单列表
     * param: [bo]
     * author: chenyu.wang
     * date: 2020-07-30
     * return: com.baomidou.mybatisplus.plugins.Page<com.ztgf.order.models.vo.OrderInfoPageListVO>
     */
    Page<OrderInfoPageListVO> queryAdminListPage(OrderAdminListBO bo);

    /**
     * description: 后台交易订单列表
     * param: [bo]
     * author: chenyu.wang
     * date: 2020-07-30
     * return: com.baomidou.mybatisplus.plugins.Page<com.ztgf.order.models.vo.OrderInfoPageListVO>
     */
    Page<OrderInfoPageListVO> queryDealOrderListPage(OrderAdminListBO bo);

    /*
     * @description:后台管理系统代客下单列表
     * @author: chenyu.wang
     * @date: 2020-08-10
     * @param:
     * @return:
     */
    Page<OrderValetPlaceVO> queryValetPlaceOrderList(OrderValetPlaceBO bo);

    /**
     * @Description: 查询待签收的先款订单
     * @Author: chenyu.wang
     * @Param: []
     * @Date: 2020.10.22 17:40
     */
    List<OrderLogisticsVO> queryAdvanceOrderList(Long lastNo);

    /**
     * @return : java.util.List<com.ztgf.order.models.vo.OrderContractVO>
     * @Author :chenyu.wang
     * @Description : 新的确定订单
     * @Date : 10:31 2021.01.08
     * @Param : [bo, signShopId, type]
     **/
    List<OrderContractVO> newSureOrder(String orderIds, Long signShopId, int type, List<byte[]> bytes, String annex);

    /**
     * @return : java.util.List<com.ztgf.order.models.vo.ExportAdminOrderListQueryVO>
     * @Author :chenyu.wang
     * @Description : 后台管理系统订单导出查询
     * @Date : 2021.02.25 16:35
     * @Param : []
     **/
    List<ExportAdminOrderListVO> queryExportAdminOrderList(Long shopId, String ids, Integer status);
    /**

     * @author  hasee
     * @Param
     * @Return  后台管理系统订单导出查询重构
     * @create  2021/12/3 14:52
     * @desc

     **/
    List<ExportAdminOrderListVO> queryExportAdminOrderList(OrderAdminListBO bo);

    /**
     * @return : java.util.List<com.ztgf.order.models.vo.ExportAdminOrderListQueryVO>
     * @Author :chenyu.wang
     * @Description : 后台管理系统订单导出查询
     * @Date : 2021.02.25 16:35
     * @Param : []
     **/
    List<ExportAdminOrderListVO> queryExportAdminOrderList(Long shopId, String ids, Integer status,Integer purchaseOrderType);

    /**
     * @return : java.util.List<com.ztgf.order.models.vo.ExportSellerOrderListQueryVO>
     * @Author :lv.zeming
     * @Description : 后台管理系统订单导出查询
     * @Date : 2021.02.25 16:35
     * @Param : []
     **/
    List<ExportSellerOrderListVO> queryExportSellerOrderList(Long shopId, String ids, Integer status,Integer purchaseOrderType);

    /**
     * @return : java.util.List<com.ztgf.order.models.vo.ExportBuyerOrderListVO>
     * @Author :chenyu.wang
     * @Description : 买家订单导出查询
     * @Date : 2021.03.02 11:09
     * @Param : [shopId, ids, status]
     **/
    List<ExportBuyerOrderListVO> queryBuyerOrderList(Long shopId, String ids, Integer status,Integer purchaseOrderType);

    /**
     * @return : boolean
     * @Author :chenyu.wang
     * @Description : 检查订单是否存在询价并还未改价的订单
     * @Date : 2021.03.12 14:44
     * @Param : [orderIds]
     **/
    boolean checkOrderIsInquiry(String orderIds);

    /**
     * 根据订单ID查询电子回执单
     *
     * @param orderId orderId
     * @param shopId  userId
     * @return 回执单URL
     */
    List<String> printingElectronicReceipt(String orderId, String shopId, String date);
    /**
     * 根据订单ID批量打印电子回执单
     *
     * @param list<PayBatchPrintBO> list
     * @return PayBatchPrintVO
     */
    PayBatchPrintVO printingBatchElectronicReceipt(List<PayBatchPrintBO> list);

    /**
     * 同意票据支付
     * @param id
     * @return
     */
    Result saveAgreeBillPay(Long id);

    /**
     * 不同意票据支付
     * @param id
     * @return
     */
    Result saveNoAgreeBillPay(Long id);
    /**
     * 同步商品列表数据
     * @param
     * @return
     */
    Result getOrderCategory();
/**
 * @author: Eric
 * @description: 商品发票管理
 * @date: 2022/3/25 9:47
 * @params:
 * @return
 */
    Page<OrderInfoShipVO> queryOrderShip(OrderAdminListBO bo);
}
